<template>
	<view class="contont">
			<input type="text"  placeholder="请输入旧密码" v-model="Passwors" />
			<input type="text"  placeholder="请输入新密码" v-model="Password" />
			<input type="text"  placeholder="再次确认密码" v-model="Passwored" />
			<button @click="reg" >提交</button>
	</view>
</template>

<script>
	import {ajax} from '../../api.js'
		export default{
			data(){
				return{
					Passwors:"", 
					Password:"",
					Passwored:"",
					
				}
			},
			onLoad(option) {
				
				this.list=option.id
			},
			methods:{
				reg(){
					if(this.Password==''&&this.Password==''&&this.Passwors==""){
						uni.showToast({
						    title: '请输入密码',
							icon:"none"
						})
						}else if(this.Password!=this.Passwored){
						uni.showToast({
						    title: '两次设置的密码的不一致,请重新设置!',
							icon:"none"
						})
					}else{
						ajax({
							url:"/v1/appdriver/modifypwd/"+this.list,
							method:"get",
							data:{
								id:this.list,
								oldpassword:this.Passwors,
								newpassword:this.Password,
								passwordconfirm:this.Passwored,
							},
							success(res){
								
								if(res.data.status=="OK"){
									
							uni.reLaunch({
								url:"./index"
							})
								}else{
									uni.showToast({
									    title: '老密码输入错误',
										icon:"none"
									})
								}
							}
						})

					}
				
				}
			}
		}
</script>

<style>
input{
		width:345px;
		height:44px;
		border-radius:8px;
		background:rgba(245,245,245,1);
		background-image: url(../../static/img/icon_mima@3x.png);
		background-repeat: no-repeat;
		background-size: 14px,18px;
		background-position: 15px 13px;
		padding-left: 40px;
		box-sizing: border-box;
		font-size: 14px;
		margin-top: 15px;
	}
	button{
		width:345px;
		height:44px;
		background:rgba(4,42,88,1);
		border-radius:8px;
		font-size: 16px;
		margin-top: 30px;
		color: #FFFFFF;
	}
</style>
